/*
 * @Author: zxc
 * @Date: 2020-10-07 15:03:01
 * @LastEditTime: 2020-10-07 15:22:11
 * @LastEditors: zxc
 * @Description: snabbdom 模块的用法
 */
import { h, init } from "snabbdom";
import styles from "snabbdom/modules/style";
import eventlisteners from "snabbdom/modules/eventlisteners";

let patch = init([styles, eventlisteners]);
let vnode = h(
  "div",
  {
    style: {
      background: "red",
    },
    on: {
      click: eventHandler,
    },
  },
  [h("h1", "Ttile"), h("p", "这里P标签")]
);

function eventHandler() {
  console.log("点我了~");
}

let app = document.getElementById("app");

let oldNodes = patch(app, vnode);
